// adding Time using operator overloading

# include <iostream.h>
# include <conio.h>

class MyTime {
public:
  int days,hours,minutes,seconds;
  MyTime (int hrs, int mins, int secs);
  MyTime operator+(MyTime now);
  void printTime();
};

MyTime::MyTime(int hrs, int mins, int secs) {
 days = 0;
 minutes = mins;
 hours = hrs;
 seconds = secs;
}

MyTime MyTime::operator+(MyTime now) {
 MyTime time(0,0,0);
 seconds += now.seconds;
 minutes += now.minutes+(seconds/60);
 hours += now.hours+(minutes/60);
 days += now.days+(hours/24);
 time.days = days;
 time.seconds = seconds%60;
 time.minutes = minutes%60;
 time.hours = hours%24;
 return time;
}

void MyTime::printTime() {
 cout << days << "d " << hours << ":" << minutes << ":" << seconds;
}

void main() {
 clrscr();
 MyTime then(10,10,10);
 MyTime now(62,682,200);
 MyTime time = then+now;
 time.printTime();
 getch();
}